package cn.yanxiaohui.service.web.pattern.linked;
/**
 * @Description 责任链设计模式
 * @Author： yanxh<br>
 * @Date 2019/12/6 16:26<br>
 * @Version 1.0<br>
 */
public abstract class NodeHandler {

    private NodeHandler nextHandler;

    public abstract void handler();

    /**
     * @Description 执行下一个handler
     * @Author： yanxh<br>
     * @Date 2019/12/6 11:27<br>
     * @Version 1.0<br>
     */
    public void nextHandler(){
        if(nextHandler != null){
            nextHandler.handler();
        }
    }

    public void setNextHandler(NodeHandler nextHandler) {
        this.nextHandler = nextHandler;
    }
}
